import React, {Component} from 'react';
import About from "./pages/About";
import Home from "./pages/Home";
import Header from "./components/Header"

import {Route,Switch,Redirect} from "react-router-dom"
import MyNavLink from "./components/MyNavLink";
class App extends Component {
    render() {

        return (
            <div>
                <div className="row">
                    <div className="col-xs-offset-2 col-xs-8">
                        <Header a={12313}/>
                    </div>
                </div>
                <div className="row">
                    <div className="col-xs-2 col-xs-offset-2">
                        <div className="list-group">
                            {/*<MyNavLink>这个属性是props的children属性</MyNavLink>*/}
                           <MyNavLink to="/about" children="About"/>
                            <MyNavLink to="/home" children="Home"/>
                        </div>
                    </div>
                    <div className="col-xs-6">
                        <div className="panel">
                            <div className="panel-body">
                                {/*  注册路由*/}
                                <Switch>
                                    <Route path={"/about"} component={About}></Route>
                                    <Route path={"/home"} component={Home}></Route>
                                    <Redirect to="/about"/>
                                </Switch>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        );
    }
}

export default App;
